﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Text;
using Newtonsoft.Json;
using System.Windows.Media.Imaging;

namespace ITU.Yemekhane.App7
{
    public partial class MainPage : PhoneApplicationPage
    {


        // Constructor
        public MainPage()
        {
            //MultiResImageChooserUri uri = new MultiResImageChooserUri();
            //BitmapImage bgImage = new BitmapImage(uri.BestResolutionImageBackground);
            //this.PanaromaBrush.ImageSource = bgImage;
            InitializeComponent();

            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

        // Load data for the ViewModel Items
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!App.ViewModel.IsDataLeftLoaded || !App.ViewModel.IsDataRightLoaded)
            {
                App.ViewModel.LoadData();
            }
        }

        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {

        }
    }
}